<?php
/**
 * @version		$Id: helper.php 20228 2011-01-10 00:52:54Z eddieajau $
 * @package		Joomla.Site
 * @subpackage	mod_banana_slideshow
 * @copyright	Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;

jimport('joomla.application.component.model');

class modBananaSlideshowHelper
{	
    public static function getList(&$params) {
        $rows = array();
		$db = JFactory::getDbo();
		
		// Filter by start and end dates.
		$nullDate = $db->Quote($db->getNullDate());
		$nowDate = $db->Quote(JFactory::getDate()->toMySQL());
		
		$query = "	SELECT s.*, p.catid AS item_catid
					FROM #__je_fs s 
					JOIN #__je_products p ON s.item_id = p.id
					WHERE s.state = 1 AND p.state = 1 
							AND (s.publish_up = $nullDate OR s.publish_up <= $nowDate)
							AND (s.publish_down = $nullDate OR s.publish_down >= $nowDate)
					ORDER BY s.ordering";
		
		#echo str_replace('#__', 'tbl_', $query);
		
		$db->setQuery($query);
		$rows = $db->loadObjectList();	
		
		return $rows;
    }
}
